
# coding:utf-8
import time
from xtquant import xtdata
code='600031.SH'
#订阅最新行情
def callback_func(data):
    print('回调触发')
    stock_code=list(data.keys())
    df=xtdata.get_full_tick(code_list=stock_code)
    print(df)
    xtdata.subscribe_quote(stock_code=code,start_time='20240101',end_time='20240525',period='1m')
    hist=xtdata.get_market_data(stock_list=[code],start_time='20240101',end_time='20240525',period='1m')
    print(hist)
xtdata.subscribe_whole_quote(code_list=[code],callback=callback_func)
#死循环 阻塞主线程退出
xtdata.run()

